#include<iostream>
#include<pthread.h>
#include<unistd.h>
#include<string>

void *threadrun(void *args)
{
    std::string name = (const char*)args;
    while(true)
    {
        std::cout<<"我是新线程: name: "<<name<<std::endl;
        sleep(1);
    }
}

int main()
{
    pthread_t tid;
    pthread_create(&tid,nullptr,threadrun,(void*)"thread-1");
    while(true)
    {
        std::cout<<"我是主线程"<<std::endl;
        sleep(1);
    }

    return 0;
}